<?php
include_once 'conn.php';
$sql = "select carName,carNum from carinfo where ok = 1 order by carNum desc ";
$result = mysqli_query($conn,$sql);
$a = array();
if(mysqli_errno($conn)){
    $a['code'] = -1;
    $a['msg'] = '查询数据库出错';
}
else{
    $a['code'] = 200;
    $a['xAxis'] = array();
    $a['series'] = array();
    while ($info = mysqli_fetch_array($result)){
        $a['xAxis'][] = $info['carName'];
        $a['series'][] = $info['carNum'];
    }
}
echo json_encode($a);